$().ready(function() {

$('input[@type=submit]')
  .attr('onclick', 'return false;')
  .click(function(e) {
    // If bio 25, check wich destination was choose
    var dest2 = $('input[@name=destination2]');
    if (dest2.val() != null && dest2.val() != '')
      var destination = '#'+ dest2.val() + ' - Fleet';
    else
      var destination = $('#awplus_planet option[@value='+$('#awplus_planet').val()+']').text();

    // Build HTML
    var html = '<div id="ap_launch_confirm" align="center">';
    html += 'Check if your chooses are corrects...';
    html += '<table cellspacing="1" cellpadding="1" align="center" style="text-align: center;">';
    html += '<tr bgcolor="#202060"><th>'+$('#awplus_content table:eq(0) tr:eq(0) td:eq(0)').text()+'</th><th>Qty</th></tr>';
    html += '<tr bgcolor="#404040"><td width="250">Transport:</td><td>'+$('input[@name=inf]').val()+'</td></tr>';
    html += '<tr bgcolor="#404040"><td>Colony Ship:</td><td>'+$('input[@name=col]').val()+'</td></tr>';
    html += '<tr bgcolor="#404040"><td>Destroyer:</td><td>'+$('input[@name=des]').val()+'</td></tr>';
    html += '<tr bgcolor="#404040"><td>Cruiser:</td><td>'+$('input[@name=cru]').val()+'</td></tr>';
    html += '<tr bgcolor="#404040"><td>Battleship:</td><td>'+$('input[@name=bat]').val()+'</td></tr>';
    html += '<tr bgcolor="#202060" align="center"><th colspan="2">Destination</th></tr>';
    html += '<tr bgcolor="#404040"><td>System:</td><td>'+destination+'</td></tr>';
    html += '<tr bgcolor="#404040"><td>ID:</td><td>'+$('input[@name=planet]').val()+'</td></tr>';
    html += '<tr bgcolor="#404040"><td>Arrival Time Calculator:</td><td>'+$('#awplus_ttc').text()+'</td></tr>';
    var nap = $('input[@name=nap]:checked').size() > 0  ? 'Yes' : 'No';
    html += '<tr bgcolor="#404040"><td>Disregard NAP:</td><td>'+nap+'</td></tr>';
    html += '<tr bgcolor="#602020"><td colspan="2">';
    html += '<input id="ap_launch_cancel" type="button" value="Cancel!!!" class="smbutton" /> &nbsp;&nbsp;';
    html += '<input id="ap_launch_submit" type="button" value="Launch!!!" class="smbutton" />';
    html += '</td></tr>';
    html += '</table>';
    html += '</div>';

    $('#awplus_content table:eq(0)').attr('id', 'ap_launch_settings').before(html).hide();
    $('#ap_launch_cancel').click(function() {
      $('#ap_launch_confirm').remove();
      $('#ap_launch_settings').show();
    });
    $('#ap_launch_submit').click(function () {
      $('form[@name=fleet]')[0].submit();
    });
  });


});
